package com.mswyt.utils.config.constants;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: MsConstant
 * @Description: 一些从配置文件读取的常量定义
 */
@Configuration
public class ApplicationConstant {
    //------------mp一些配置拦截---
    //是否开启了驼峰转换
    public static String msMpCamel;

    //--------msExcel配置-----
    //存放模板路径
    public static String msExcelPath;

    //---------全局一些缓存配置-----
    //是否开启字典数据缓存，默认false
    public static String msCacheDict;
    //是否开启handleBean包下处理数据映射所解析到的sql缓存，默认开启
    public static String msCacheHbSql;
    //---------------msHandleBean包下一些配置
    //表的业务id字段名称，默认是id
    public static String msHbBizIdName;
    //值为true：动态的获取每个实体类上加上@TableId注解绑定的主键id值，如果id继承自父类，抛出异常。默认false。
    public static String msHbBizIdNameDynamic;
    //表里默认的逻辑删除字段值，比如delfag=0,表示未被删除的数据
    public static String msHbDelSing;
    //@MsJoinDict注解：字典转义默认取的字段值，默认取label标签...取值来源于MsDictDto类
    public static String msHbDictNeedFiled;
    //@MsJoinDict注解：字典值存在多个时候，默认的拼接符，比如0;1;2转换成值1;值2;值3
    public static String msHbDictSplit;
    //@MsJoinTable注解：关联表时，默认当前注解上的字段值，与left join 表的id进行关联。
    public static String msHbTbJoinField;
    //@MsSaveCheck注解：保存前，根据XX字段值(一般为表的id)，存在就排除自己，不存在就与全表所有数据比较
    public static String msHbSaveBizFiled;
    //@MsSaveCheck注解，保存前检验不通过的数据以XX字符拼接
    public static String msHbSaveCheckSplit;
    //@MsJoinSubTable 如果开启了List<Map>的key转驼峰，请配置true,否则会报错...
    public static String msHbOpenCamel;
    //开启多数据源功能,默认false
    public static String msDbOpenDataSource;
    //默认开启日志打印功能，主要用于@MsExecuteTime注解
    public static String msLogOpenPrint;
    //是否开启工具类的日志打印，默认false，主要用于工具类方法的执行日志。
    public static String msLogOpenInnerPrint;


    @Value("${ms.hb.del-sing:deflag=0}")
    public void setMsHbDelSing(String delSing) {
        this.msHbDelSing = delSing;
    }

    @Value("${ms.hb.dict-need-field:label}")
    public void setMsHbDictNeedFiled(String label) {
        this.msHbDictNeedFiled = label;
    }

    @Value("${ms.hb.dict-split:;}")
    public void setMsHbDictSplit(String split) {
        this.msHbDictSplit = split;
    }

    @Value("${ms.hb.tb-join-field:id}")
    public void setMsHbTbJoinField(String joinId) {
        this.msHbTbJoinField = joinId;
    }

    @Value("${ms.hb.biz-id-name:id}")
    public void setMsHbBizIdName(String bizIdName) {
        this.msHbBizIdName = bizIdName;
    }

    @Value("${ms.hb.biz-id-name-dynamic:false}")
    public void setMsHbBizIdNameDynamic(String bizIdNameDynamic) {
        this.msHbBizIdNameDynamic = bizIdNameDynamic;
    }

    @Value("${ms.hb.save-biz-field:id}")
    public void setMsHbSaveBizFiled(String bizFiled) {
        this.msHbSaveBizFiled = bizFiled;
    }

    @Value("${ms.cache.dict:false}")
    public void setMsCacheDict(String cacheDict) {
        this.msCacheDict = cacheDict;
    }

    @Value("${ms.cache.hb-sql:true}")
    public void setMsCacheHbSql(String cacheHbSql) {
        this.msCacheHbSql = cacheHbSql;
    }

    @Value("${mybatis-plus.configuration.mapUnderscoreToCamelCase:false}")
    public void setMsMpCamel(String camel) {
        this.msMpCamel = camel;
    }

    @Value("${ms.hb.open-camel:false}")
    public void setMsHbOpenCamel(String openCamel) {
        this.msHbOpenCamel = openCamel;
    }

    @Value("${ms.hb.save-check-split:   }")
    public void setMsHbSaveCheckSplit(String checkSplit) {
        this.msHbSaveCheckSplit = checkSplit;
    }

    @Value("${ms.excel.file-path:/static/template/}")
    public void setMsExcelPath(String excelPath) {
        this.msExcelPath = excelPath;
    }

    @Value("${ms.db.open-data-source:false}")
    public void setMsDbOpenDataSource(String dataSource) {
        this.msDbOpenDataSource = dataSource;
    }

    @Value("${ms.log.open-print:true}")
    public void setMsLogOpenPrint(String logOpenPrint) {
        this.msLogOpenPrint = logOpenPrint;
    }
    @Value("${ms.log.open-inner-print:false")
    public void setMsLogOpenInnerPrint(String logOpenInnerPrint) {
        this.msLogOpenInnerPrint = logOpenInnerPrint;
    }

}
